package variasImagenes;

import javax.imageio.ImageIO;

import ij.ImagePlus;
import hips.Image;
import hips.Partition;


public class Main {

	public static void main(String[] args) {
		try {
			ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
			ImagePlus bmw = new ImagePlus("BMW", ImageIO.read(classLoader.getResourceAsStream("bmw.jpg")));
			ImagePlus blanca = new ImagePlus("Blancanieves", ImageIO.read(classLoader.getResourceAsStream("blancanieves.jpg")));
			ImagePlus sexy = new ImagePlus("Chica sexy", ImageIO.read(classLoader.getResourceAsStream("sexy.jpg")));
			processImage(bmw);
			processImage(blanca);
			processImage(sexy);
		} catch (Exception e) {}
	}

	public static void processImage(ImagePlus impl){
		Image img = Image.getImage(impl);
		Partition p = img.newPartition(Partition.IMPROVED_WITHOUT_CINDEX, img.newPixelValue(50), img.newPixelValue(100), 0, 10);
    	p.makeRegions();
    	System.out.println("Imagen: " + impl.getTitle());
    	System.out.println("Numero de regiones: " + p.getRegionSize());
    	System.out.println("");
	}
	
}
